<?php
@session_start();
include '../Security/CheckUser.php';
include '../Home/DefineVar.php';
include '../DataBase/ConnectDB.php';
//予約をキャンセルする。
mysql_select_db(MYSQL_DATABASE,$link);
$id=mysql_real_escape_string($_GET['id']);
$result=mysql_query("SELECT cancelfee FROM ".MYSQL_TABLE_ROOMINFOR." WHERE roomname in (SELECT roomname FROM ".MYSQL_TABLE_ORDER." WHERE orderid ='".$id."')",$link);
if(mysql_num_rows($result)!=0){
	$row=mysql_fetch_array($result);
}
//print($row[0]);
$result=mysql_query("UPDATE ".MYSQL_TABLE_ORDER." SET orderstatus ='0', canceltime ='".date("Y-m-d")."', fee ='".$row[0]."' WHERE orderid =".$id,$link);
if(!$result)
print("<br> <script type='text/javascript'> alert('".CANCEL_ORDER_ERR_MESS."');  window.location ='../Admin/SearchOrder.php';</script>");

else
print("<br> <script type='text/javascript'> alert('".CANCEL_ORDER_OK_MESS."');  window.location ='../Admin/SearchOrder.php';</script>");